home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / packet / p_tapr / tnchst / dlc.inc < prev    next >
Text File  |  1991-02-12  |  2KB  |  94 lines

  1. #ifndef DLC_INCLUDES
  2.  
  3. #define    DLC_INCLUDES
  4.  
  5. #define    DLC_RETRY_TIME    3
  6.     /* retry time in seconds - must be 0<=x<=32767 */
  7.  
  8. #define DLC_MAX_TRIES    10
  9. #define    DLC_MAX_OUTSTANDING 15
  10.  
  11. #define    DLCDATASIZE    350        /* max size of data fields */
  12. #define    ADDRSIZE    9*7
  13.  
  14. #define    DEFAULT_DLC_PEER 0x01        
  15.                     /* if we initiate dlc reset, call
  16.                        the guy with this address */
  17.  
  18. #define    GLOBALDLC    0xFF        /* global dlc address */
  19.  
  20.    /* show state changes */
  21. #define    DLC_EVENT_TRACE    FALSE
  22.  
  23.  
  24.  
  25.  
  26. struct   dlc_frame_struct {        /* structure of dlc frames */
  27.     byte    cmd ;            /* command */
  28.     byte    data[ DLCDATASIZE ] ;    /* data field */
  29.     byte    nul1,nul2;        /* these NULL fields take note
  30.                        of bytes used by addrsg scheme
  31.                        and should disappear when
  32.                        this stuff is replaced w/ a
  33.                        union template */
  34.     };
  35.  
  36. struct    dl_data_struct {        /* structure holding pktzd tx data*/
  37. /*    byte    dest, src; */
  38.     word    len ;            /* for linked list */
  39.     struct    dl_data_struct *next ;    /* linked list - next pkt */
  40.     byte    data[ DLCDATASIZE ] ;
  41.     };
  42.  
  43.  
  44.     /* structure controls all aspects of a particular DLC interface,
  45.        specifically DLC for .lcn */
  46. struct    dlccb_struct {
  47.     byte    dlc_peer_addr ;        /* other fella's dlc address */
  48.     byte    dlc_state ;        /* state of dlc link */
  49.     byte    dlctxseq, dlcrxseq ;    /* seq #'s */
  50.     byte    retry_count, outstanding ;    /* curr retry cnt, # tx outs */
  51.     int    timer ;
  52.     struct    dl_data_struct dl_next ;    /* dummy hdr */
  53.     };
  54.  
  55.     /* structure used by dlc state tables */
  56. struct    dlc_state_entry {
  57.                 /* handler for the state */
  58.     void    (*action_handler) (struct dlccb_struct *,
  59.                    struct dlc_frame_struct *, word );
  60.     byte    newstate ;    /* new state */
  61.     };
  62.  
  63.  
  64.  
  65. /**** states
  66.  
  67.          Note that states must start at state 1! ****/
  68.  
  69. #define    DNSTATES    4
  70. #define    DNEVENTS    9
  71.  
  72. /*    states */
  73.  
  74. #define    DLIDLE        1
  75. #define    DLRESET        2
  76. #define    DLDATA        3
  77. #define    DLDWAIT        4
  78.  
  79.     /** events **/
  80.  
  81. #define    D_RX_RESET    0
  82. #define D_RX_RESET_ACK    1
  83. #define D_RX_DATA    2
  84. #define D_ALL_ACK    3
  85. #define D_TIMERX    4
  86. #define D_Q_DATA    5
  87. #define D_LSTART    6
  88.  
  89. #define D_RETRYX    7
  90. #define D_RX_ACK    8
  91.  
  92.  
  93. #endif
  94.